/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * pruebA.java
 *
 * Created on 15/11/2011, 01:27:45 PM
 */

package prueba_1;

/**
 *
 * @author AGUSTIN MEDRANO
 */
import java.sql.*;
import java.util.Hashtable;

public class pruebA extends javax.swing.JFrame {

    public pruebA() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(170, 170, 170)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(23, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) throws Exception {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new pruebA().setVisible(true);
            }
        });
        Connection conn=null;
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
            conn=DriverManager.getConnection("jdbc:odbc:Contabilidad"," "," ");
            if(conn!=null){
                Statement stmt=conn.createStatement();
                ResultSet res=stmt.executeQuery("select * from Cuenta");
               while(res.next())
               {
                    System.out.println(res.getString("Cve_Cu")+"  "+res.getString("Nom_Cu"));
               }
               res.close();
               stmt.close();
               conn.close();
            }
        }
        catch(ClassNotFoundException ex){
            System.out.println(ex);
        }
        catch(SQLException ex){
            System.out.println("no se conecto ex");
        }
        
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables

}
